Skip to content

Conversation

@nathanclevenger
Copy link

Problem

Node.js ESM mode requires explicit file extensions for subpath imports from packages. The current code imports from react-reconciler/constants without the .js extension, which works in Bun but fails in Node.js:

Error: Cannot find module 'react-reconciler/constants' 
imported from @opentui/react/index.js
Did you mean to import "react-reconciler/constants.js"?

This breaks projects using @opentui/react with Node.js-based test runners like Vitest running in ESM mode.

Solution

Add the .js extension to the two react-reconciler/constants imports:

  • packages/react/src/reconciler/host-config.ts
  • packages/react/src/reconciler/reconciler.ts

This is backward compatible - the .js extension works correctly in both Bun and Node.js.

Testing

Tested with Vitest in a pnpm monorepo - the import errors are resolved.

….js ESM

Node.js ESM requires explicit file extensions for subpath imports.
Without the .js extension, Node.js throws:

  Error: Cannot find module 'react-reconciler/constants'
  Did you mean to import "react-reconciler/constants.js"?

This affects projects using @opentui/react with Node.js test runners
like Vitest that run in ESM mode.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kommander
Copy link
Collaborator

@msmps you can probably better judge the impact.

@msmps msmps self-assigned this Jan 13, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 17, 2026

@opentui/core

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core@511

@opentui/react

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/react@511

@opentui/solid

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/solid@511

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-arm64@511

@opentui/core-darwin-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-x64@511

@opentui/core-linux-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-arm64@511

@opentui/core-linux-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-x64@511

@opentui/core-win32-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-arm64@511

@opentui/core-win32-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-x64@511

commit: 059af48

@kommander
Copy link
Collaborator

I just realized "which works in Bun but fails in Node.js", but there is no way currently to use opentui with nodejs as it is bun FFI only. So I don't see what this would solve?

@remorses
Copy link
Contributor

Yeah the user probably tried running it in Node.js and this was the first visible issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants